package com.demo10;

import java.util.Calendar;
import java.util.Scanner;

public class CalenderDemo {
    public static void main(String[] args) {
        //获取抽象类日历对象
        Calendar c = Calendar.getInstance();
        System.out.println("请输入年份");
        //用户手动输入年
        Scanner scanner = new Scanner(System.in);

        int year = scanner.nextInt();

        //获取设置年份的信息展示计算
        c.set(year,2,1);//设置3月日期

        c.add(Calendar.DATE,-1);//设置二月份

        int day = c.get(Calendar.DATE);

        System.out.println(year+"年的2月份有"+day+"天");
    }
}
